package cn.tradewin.advisor.pages.master;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import cn.tradewin.advisor.persist.model.Job;
import cn.tradewin.advisor.persist.services.JobService;

public class JobAdd {
	
	@Property
	private Job job;

	@Inject
	private JobService jobService;
	
	void onPrepare() {
		if (job == null) {
			job = new Job();
		}
	}

	Object onBack() {
		return JobBoard.class;
	}

	Object onSubmit() {
		jobService.addJob(job);
		return JobBoard.class;
	}
}
